package com.lmx.repoDomain.tmodel;

import io.katharsis.resource.annotations.JsonApiResource;
import io.katharsis.resource.annotations.JsonApiToOne;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.ForeignKey;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import javax.persistence.Transient;

import org.hibernate.annotations.Fetch;
import org.hibernate.annotations.FetchMode;

import com.lmx.repoDomain.tmodel.business.User;

/**
 * 位置报表辅助表
 *
 * @author ytche
 * @date 2017年6月1日
 *
 */
@Entity
@Table(name = "tnb_person_location_report")
@JsonApiResource(type = "personLocationReport")
public class PersonLocationReport extends BaseEntity {

	private static final long serialVersionUID = 1L;
	private Integer createTime;
	private Employee employee;
	private User user;
	private Room room;
	private Integer minitus;
	private WorkTimeSetting wortTimeSetting;
	private Integer generateTime;
	private Integer allDayFlag;

	private Integer countWorkTime;

	@JsonApiToOne
	@ManyToOne(fetch = FetchType.EAGER, cascade = CascadeType.REFRESH)
	@Fetch(FetchMode.JOIN)
	@JoinColumn(name = "employee_id", foreignKey = @ForeignKey(name = "null"))
	public Employee getEmployee() {
		return employee;
	}

	public void setEmployee(Employee employee) {
		this.employee = employee;
	}

	@JsonApiToOne
	@ManyToOne(fetch = FetchType.EAGER, cascade = CascadeType.REFRESH)
	@Fetch(FetchMode.JOIN)
	@JoinColumn(name = "user_id", foreignKey = @ForeignKey(name = "null"))
	public User getUser() {
		return user;
	}

	public void setUser(User user) {
		this.user = user;
	}

	@JsonApiToOne
	@ManyToOne(fetch = FetchType.EAGER, cascade = CascadeType.REFRESH)
	@Fetch(FetchMode.JOIN)
	@JoinColumn(name = "room_id", foreignKey = @ForeignKey(name = "null"))
	public Room getRoom() {
		return room;
	}

	public void setRoom(Room room) {
		this.room = room;
	}

	@Column(name = "create_time")
	public Integer getCreateTime() {
		return createTime;
	}

	public void setCreateTime(Integer createTime) {
		this.createTime = createTime;
	}

	@Column(name = "minitus")
	public Integer getMinitus() {
		return minitus;
	}

	public void setMinitus(Integer minitus) {
		this.minitus = minitus;
	}

	@JsonApiToOne
	@ManyToOne(fetch = FetchType.EAGER, cascade = CascadeType.REFRESH)
	@Fetch(FetchMode.JOIN)
	@JoinColumn(name = "work_time_set_id", foreignKey = @ForeignKey(name = "null"))
	public WorkTimeSetting getWortTimeSetting() {
		return wortTimeSetting;
	}

	public void setWortTimeSetting(WorkTimeSetting wortTimeSetting) {
		this.wortTimeSetting = wortTimeSetting;
	}

	@Transient
	public Integer getCountWorkTime() {
		return countWorkTime;
	}

	public void setCountWorkTime(Integer countWorkTime) {
		this.countWorkTime = countWorkTime;
	}

	@Column(name = "generate_time")
	public Integer getGenerateTime() {
		return generateTime;
	}

	public void setGenerateTime(Integer generateTime) {
		this.generateTime = generateTime;
	}

	@Column(name = "all_day_flag")
	public Integer getAllDayFlag() {
		return allDayFlag;
	}

	public void setAllDayFlag(Integer allDayFlag) {
		this.allDayFlag = allDayFlag;
	}

}
